#include "SMPPQueryBroadcastRequestOptionalTLVs.hpp"

using namespace smpp::pdu;

QueryBroadcastRequestOptionalTLVs::QueryBroadcastRequestOptionalTLVs(
const UserMessageReference *nUserMessageReference):
_UserMessageReference(0){
	if(nUserMessageReference)
		_UserMessageReference = 
		new UserMessageReference(*nUserMessageReference);
}

QueryBroadcastRequestOptionalTLVs::QueryBroadcastRequestOptionalTLVs(
const QueryBroadcastRequestOptionalTLVs &
nQueryBroadcastRequestOptionalTLVs):_UserMessageReference(0){
	if(nQueryBroadcastRequestOptionalTLVs.getUserMessageReference())
		_UserMessageReference = new UserMessageReference(
		*nQueryBroadcastRequestOptionalTLVs.getUserMessageReference());
}

QueryBroadcastRequestOptionalTLVs::~QueryBroadcastRequestOptionalTLVs(){
	if(_UserMessageReference)
		delete _UserMessageReference;
}

void QueryBroadcastRequestOptionalTLVs::setUserMessageReference(
	const UserMessageReference *nUserMessageReference){
	if(_UserMessageReference){
		delete _UserMessageReference;
		_UserMessageReference = 0;
	}
	if(nUserMessageReference)
		_UserMessageReference = 
		new UserMessageReference(*nUserMessageReference);
}

const UserMessageReference *
	QueryBroadcastRequestOptionalTLVs::getUserMessageReference() const{
	return _UserMessageReference;
}

const quint16 QueryBroadcastRequestOptionalTLVs::getLength() const{
	quint16 length(0);
	if(_UserMessageReference)
		length += 4 + _UserMessageReference->getLength();
	return length;
}
